<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE HTML>  
<html>
<head>
<meta charset="utf-8"/>
<script type="text/javascript">
	function $$(id) {
		return document.getElementById(id);
	}
	
	
	var work;
	
	function create() {
		work = new Worker('../js/work1.js');
		work.onmessage = function(e) {
			$$('workMsg').innerHTML = $$('workMsg').innerHTML + e.data + ', ';
		};
	}

	function send() {
		alert('send:');
		work.postMessage($$('msg').value);
	}
	
	function closeWork() {
		alert('terminate:');
		work.terminate();
	}
	
</script>

</head>
<body>
	<textarea rows="5" cols="50" id="msg"></textarea><br/>
  	<button onclick="send()">send</button>
  	<button onclick="closeWork()">close</button>
  	<button onclick="create()">create</button>

	<div id="workMsg"></div>
</body>
</html>